<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>name</title>

    <!-- 引入样式 -->

    <link rel="stylesheet" href="../plugins/elementui/index.css">

    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">

    <link rel="stylesheet" href="../css/style.css">

</head>
<body>

<div id="app">
    <h1>这是用户界面，你好用户：{{userName}}</h1>
</div>

<!--引入组件库-->
<script src="../js/vue.js"></script>

<script src="../plugins/elementui/index.js"></script>

<script type="text/javascript" src="../js/jquery.min.js"></script>

<script src="../js/axios-0.18.0.js"></script>

<script>
    new Vue({
        el: "#app",
        data:{
            userName:''
        },

        //钩子函数，VUE对象初始化完成后自动执行
        created() {
            this.getSession();
        },

        methods:{
            getSession(){
                axios.get("/network/session").then((res)=>{
                    if (res.data.code === 20041){
                        this.userName = res.data.data.account;
                    }else {
                        alert(res.data.msg);
                    }
                });
            }
        }
    })
</script>
</body>
</html>